package com.yanqu.road.server.cmd.wingroom;

import com.yanqu.road.pb.wingroom.WingRoomProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;

/**
 * @author ：zfr
 * @date ：2022/2/23 14:22
 */
@Cmd(code = CrossProtocol.C_WING_ROOM_VISIT_OTHER_PLAYER_RESP, desc = "跨服拜访玩家厢房返回")
public class WingRoomCrossWatchOtherPlayerRespCmd extends CrossCommand {
    private long originPlayerServerId;
    private long originPlayerUserId;
    private WingRoomProto.WatchOtherPlayerRespMsg respMsg;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        WingRoomProto.CrossWatchOtherPlayerRespMsg msg = WingRoomProto.CrossWatchOtherPlayerRespMsg.parseFrom(packet.getBytes());
        originPlayerServerId = msg.getOriginPlayerServerId();
        originPlayerUserId = msg.getOriginPlayerUserId();
        respMsg = msg.getRespMsg();
        return true;
    }


    @Override
    public void execute(YanQuMessage packet) throws Exception {
        YanQuMessage message = YanQuMessageUtils.buildMessage(ClientProtocol.U_WING_ROOM_WATCH_OTHER_PLAYER, respMsg);
        MessageHelper.sendPacket(originPlayerServerId, originPlayerUserId, message);
    }

    @Override
    public void sendData() {

    }
}
